<link rel="stylesheet" href="__PUBLIC__/yksui/css/multi-select.css" rel="stylesheet"/>
<style>
    .w80{width: 80px;}

</style>
<div class="container-fluid">
    <div class="wrapper">
        <div class="panel" id="nav">
            <div class="panel-heading"><h3 class="panel-title">亚马逊物流库存事件详情报告</h3></div>
            <div class="panel-body">
                <form action="__URL__/index" method="get" id="form">
                    <div class="container-fluid">
                        <div class="col-sm-12 col-md-3 add-space">
                            <div class="input-group input-group-md">
                                <span class="input-group-addon">账号</span>
                                <select class="chosen-select form-control" tabindex="-1" name="account_id"
                                        data-name-group="common">
                                    <option value="" class="empty-opt">-- 请选择 --</option>
                                    <volist name="accounts" id="acc">
                                        <option value="{$acc.id}">{$acc.name}</option>
                                    </volist>
                                </select>
                            </div>
                        </div>
                        <div class="col-sm-12 col-md-3 add-space">
                            <div class="input-group input-group-md">
                                <span class="input-group-addon">FBA(sku)</span>
                                <input type="text" class="form-control" value="{$_GET['sku']}" name="sku">
                            </div>
                        </div>
                        <div class="col-sm-12 col-md-2 add-space">
                            <div class="input-group input-group-md">
                            <span class="input-group-addon">日期</span>
                            <select class="form-control w80" tabindex="-1" name="date">
                                <volist name="date" id="acc">
                                    <option value="{$acc}">{$acc}</option>
                                </volist>
                            </select>
                        </div>
                        </div>

                    </div>
                    <!--<div class="col-sm-12 col-md-3 add-space">-->
                        <!--<div class="input-group input-group-md">-->
                            <!--<span class="input-group-addon">销售员</span>-->
                            <!--<select class="chosen-select form-control" tabindex="-1" name="seller_ids"-->
                                    <!--data-name-group="common">-->
                                <!--<option value="" class="empty-opt">&#45;&#45; 请选择 &#45;&#45;</option>-->
                                <!--<volist name="remark" id="sel">-->
                                    <!--<option value="{$Think.lang.$key}">{$sel}</option>-->
                                <!--</volist>-->
                            <!--</select>-->
                        <!--</div>-->
                    <!--</div>-->
                    <div class="col-md-4 add-space">
                        <if condition="$_GET['account_id'] neq null">
                            <if condition="$pass eq 20">
                                <!--<input class="btn btn-danger" type="button" disabled value="已审核,不通过">-->
                                <a href="javascript:void(0)" data-toggle="modal" data-target=".btn_yy" >审核不通过,点击查看原因</a>
                                <elseif condition="$pass eq 10" />
                                    <input class="btn btn-success" type="button" disabled value="审核通过">
                                <else/>
                                <input class="btn btn-success" type="button" data-toggle="modal" data-target=".btn_ck" value="审核">
                                <!--<input class="btn btn-danger" type="button" data-toggle="modal" data-target=".btn_ck" value="审核不通过">-->
                            </if>
                        </if>
                    </div>
                    <div class="col-md-6 add-space">
                        <input class="btn btn-primary" type="submit" value="搜索">
                        <input class="btn btn-default" type="button" onclick="download()" value="导出">
                        <input class="btn btn-warning" type="button" onclick="apiGet()" value="拉取报表">
                        <input class="btn btn-success" type="button" onclick="agreeDown()" value="导出审核列表">
                        <input class="btn btn-info" type="button" onclick="unDown()" value="导出账号拉取列表">
                    </div>
                </form>
            </div>
            <hr>
            <table class="table table-striped  table-hover " cellspacing="0" width="100%">
                <thead>
                <tr>
                    <th style="border-bottom: none;"></th>
                    <th style="border-bottom: none;"></th>
                    <th style="border-bottom: none;"></th>
                    <th style="border-bottom: none;"></th>
                    <th colspan="6" class="text-center">本期入库</th>
                    <th colspan="5" class="text-center">本期出库</th>
                    <th style="border-bottom: none;"></th>
                    <th style="border-bottom: none;"></th>
                    <th style="border-bottom: none;"></th>
                </tr>
                <tr>
                    <!--<th width="40">序号</th>-->
                    <th>账号</th>
                    <!--<th>站点</th>-->
                    <th>FBA(sku)</th>
                    <th>公司(sku)</th>
                    <th>期初库存</th>
                    <th>入库</th>
                    <th>退货入库</th>
                    <th>转仓入库</th>
                    <th>盘盈入库</th>
                    <th>其它入库</th>
                    <th>入库合计</th>
                    <th>销售出库</th>
                    <th>转仓出库</th>
                    <th>盘亏出库</th>
                    <th>其它出库</th>
                    <th>出库合计</th>
                    <th>实际期末库存</th>
                    <th>理论期末库存</th>
                    <th>实际比理论相差</th>
                </tr>
                </thead>
                <tbody>
                <volist name="data" id="vo" key="num">
                    <tr>
                        <!--<td>{$num}</td>-->
                        <td>{$vo.account_name}</td>
                        <!--<td>{$vo.site}</td>-->
                        <td>{$vo.sku}</td>
                        <td>{$vo.piv_sku}</td>
                        <td>{$vo.qckc}</td>
                        <td>{$vo.bhrk}</td>
                        <td>{$vo.thrk}</td>
                        <td>{$vo.zcrk}</td>
                        <td>{$vo.pyrk}</td>
                        <td>{$vo.qtrk}</td>
                        <td>{$vo.rkhj}</td>
                        <td>{$vo.xsck}</td>
                        <td>{$vo.zcck}</td>
                        <td>{$vo.pkck}</td>
                        <td>{$vo.qtck}</td>
                        <td>{$vo.ckhj}</td>
                        <td>{$vo.qmkc}</td>
                        <td>{$vo.llqmkc}</td>
                        <td>{$vo.diff}</td>
                    </tr>
                </volist>
                </tbody>
            </table>
            <div class="clearfix clear"></div>
            <div class="row">
                <div class="col-md-6 pull-left">
                    <label>每页 20 条记录
                        显示 1 到 20 项，共 {$count}项</label>
                </div>
                <div class="col-md-6">
                    <div class="page pull-right" style="padding: 0;margin: 0">
                        {$page}
                    </div>
                </div>
            </div>

        </div>
    </div>
</div>
<div class="modal fade btn_ck">
    <div class="modal-dialog modal-sm">

        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span
                        class="sr-only">关闭</span></button>
                <h4 class="modal-title">请核对好数据审核</h4>
            </div>
            <div class="modal-body">
                <input type="text" class="form-control" name="remark" placeholder="备注（选填，不通过必填）"></div>

        </div>
        <div class="modal-footer">
            <button type="button" class="btn btn-success" data-dismiss="modal" onclick="checkOk()">通过</button>
            <button type="button" class="btn btn-danger" data-dismiss="modal" onclick="checkNot()">不通过</button>
        </div>
    </div>
</div>
<div class="modal fade btn_yy">
    <div class="modal-dialog modal-sm">

        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span
                        class="sr-only">关闭</span></button>
                <h4 class="modal-title">审核不通过原因</h4>
            </div>
            <div class="modal-body">
                <p class="text-primary">{$remark}</p></div>
        </div>
        <div class="modal-footer">
            <button type="button" class="btn" data-dismiss="modal">关闭</button>
        </div>
    </div>
</div>
<script type="text/javascript" src="__PUBLIC__/yksui/js/jquery.multi-select.js"></script>
<script type="text/javascript" src="__PUBLIC__/javascripts/admin/layer/layer.js"></script>
<script type="text/javascript">
    $(function () {
        $("select[name='account_id']").val("<?php  echo $_GET['account_id'];?>");
        $("select[name='date']").val("<?php  echo $_GET['date'];?>");
        $('select.chosen-select').chosen({
            no_results_text: '没有找到',    // 当检索时没有找到匹配项时显示的提示文本
            disable_search_threshold: 2, // 10 个以下的选择项则不显示检索框
            search_contains: true         // 从任意位置开始检索
        });
    });

</script>
<script type="text/javascript">
    function download() {
        var data = $('#form').serialize();
        window.location.href ='__URL__/index?down=ok&'+data;
    }
    function checkOk() {
        var data = $('#form').serialize();
        var remark = $.trim($('input[name="remark"]').val());
        window.location.href ='__URL__/index?pass=10&remark='+remark+'&'+data;
    }
    function checkNot() {
        var data = $('#form').serialize();
        var remark = $.trim($('input[name="remark"]').val());
        if(remark==''){
            layer.msg('请填写不通过备注', {icon: 5});
            return false;
        }else{
            window.location.href ='__URL__/index?pass=20&remark='+remark+'&'+data;
        }

    }
    function apiGet() {
        var data = $('#form').serialize();
        if(data){
            window.location.href ='__URL__/index?api=ok&'+data;
        }
    }
    //已审核列表
    function agreeDown() {
        var data = $('#form').serialize();
        if(data){
            window.location.href ='__URL__/index?agree=ok&'+data;
        }
    }
    //账号拉取列表
    function unDown() {
        var data = $('#form').serialize();
        if(data){
            window.location.href ='__URL__/index?unDown=ok&'+data;
        }
    }


</script>